/**
 * 文件名：LogTestController
 * 版权：Copyright 2017-2022 CMCC All Rights Reserved.
 * 描述：
 */

package com.hand.project.controller;

import ch.qos.logback.classic.Logger;
import com.hand.project.exception.NoPermissions;
import com.hand.project.result.ResponseResult;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.service.ResponseMessage;

/**
 *
 * logback测试类
 *
 * @author shuai.wang02@hand-china.com
 * @version 1.0
 * @date 2018/11/19 22:57
 */
@RestController
public class LogTestController {

    protected static Logger logger= (Logger) LoggerFactory.getLogger(LogTestController.class);
    @RequestMapping("/test")
    public ResponseResult test(@RequestParam(value="role") Integer role) throws Exception{

        logger.info("访问Controller");
        int i = role;

        if(i<0){
            throw new NoPermissions("无权限");

        }
        else{
            return new ResponseResult(200,"OK");
        }


    }

}
